<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="root">

    </div>
</body>
<script src="./react.js"></script>
<script src="./react-dom.js"></script>
<script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script>
<script type="text/babel">
/* 
在react中 组件分为两种 受控组件(受react状态控制的组件)和非受控组件(不受react状态控制)
*/
class App extends React.Component{
     nameRef = React.createRef();
    render(){
        return (
            <div>
                <h1>非受控组件</h1>
                <input type="text" ref={this.nameRef}/>
                <button onClick={()=>{
                    this.nameRef.current.value='好好学习天天向上'
                }}>设置默认值</button>
                <button onClick={
                    ()=>{
                       console.log( this.nameRef.current.value)
                    }
                }>获取输入框内容</button>
            </div>
        )
    }
}

ReactDOM.render(<App/>,document.getElementById("root"))
</script>
</html>